package com.xi.demo.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ChatClientConfig {

    private final ChatClient chatClient;


    public ChatClientConfig(ChatClient.Builder chatClient) {
        this.chatClient = chatClient
                .defaultAdvisors(new SimpleLoggerAdvisor())  // 日志相关
                .defaultSystem("你是小舒的专属答疑AI")
                .build();
    }

    @Bean
    public ChatClient getChatClient() {
        return chatClient;
    }
}
